#include <iostream>
#include <vector>
using namespace std;

int main(){
    int n;
    scanf("%d",&n);
    vector<int> numbers;
    for (int i=0; i<n;i++){
        int number;
        scanf("%d",&number);
        numbers.push_back(number);
    }
    while (numbers.size()>1){
        int min1=0;
        int min2=1;
        if (numbers[0]>numbers[1]){
            min1=1;
            min2=0;
        }
        for (int i=2; i<numbers.size();i++){
            if (numbers[i]<numbers[min1]){min2=min1;min1=i;}
            else if (numbers[i]<numbers[min2] && numbers[i]>numbers[min1]){min2=i;}
        }   
        
    }

    return 0;
}
